#pragma once


#include <map>
#include "Utilities.h"
#include "maya/MItMeshVertex.h"
#include "maya/MItMeshPolygon.h"
#include "maya/MItMeshEdge.h"
#include "VertexBase.h"
#include "TriangleBase.h"
#include "maya/MIntArray.h"
#include "SubMesh.h"
#include "maya/MFnMesh.h"
#include "EdgeBase.h"
#include <algorithm>

using namespace std;
class DistortionModel
{
public:
	DistortionModel(MItMeshPolygon*, MItMeshVertex*, MItMeshEdge*, MFnMesh* _mesh);
	~DistortionModel(void);

	double getOveralldistortion(int maxRadius, int colType);
	vector<VertexBase*> getVertices();
	vector<EdgeBase*> getEdges();
	map<int,VertexBase*> getVertsMap();
	map<int,EdgeBase*> getEdgeMap();


private:
	void printSubMeshSpace();
	double getDistortionAtVertex(VertexBase* vertex, int maxRadius);
	double getLongestEdgeLength(VertexBase* vertex);
	void createSubMeshSpace();
	void paintDistortionOnMesh(int colType);
	void filterDistortion();

	MItMeshPolygon* faceIt;
	MItMeshVertex* vertsIt;
	MItMeshEdge* edgeIt;
	MFnMesh* mesh;

	map<int,TriangleBase*> triangles;
	map<int,VertexBase*> vertices;
	map<int,EdgeBase*> edges;
};

